package com.muyu.system.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Administrator
 */
@Getter
@AllArgsConstructor
public enum ScoreTypeEnum {
    GOOD(1, "好评"),
    MIDDLE(2, "中评"),
    BAD(3, "差评");


    @EnumValue
    @JsonValue
    private final int code;

    private final String name;

    @JsonCreator
    public static ScoreTypeEnum getByCode(int code) {
        for (ScoreTypeEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
